package com.lm.activiti.boot.cases;

/**
 * @author lm_jcf
 * @date 2019/9/25 14:33
 */
public class IncomeCompute {

    public static void main(String[] args) {

        yearEstimate(1, 2000, 14000);

    }

    public static void yearEstimate(int year, float yearIncrement, float cardinal) {

        float count = 0;
        float consume = 0;
        float tax = 0;
        float monthConsume = 6000;

        float extraIncome = 0;
        for (int i = 0; i < year; i++) {

            float yearSurplus = 0;

            for (int j = 0; j < 13; j++) {
                double monthCardinal = cardinal - (3500 * 0.08 + 3500 * 0.02 + 3500 * 0.002);

                monthCardinal -= (monthCardinal - 5000) * 0.1 - 210;

                if (j != 0) {
                    float monthTax = 150;
/*
                    float monthTax = 0;
                    float taxCardinal = cardinal;
                    if (year >= 1) {
                        taxCardinal -= yearIncrement;
                    }
                    monthTax = taxCardinal * 0.05F + taxCardinal * 0.12F;*/

                    tax += monthTax;
                }

                count += monthCardinal;

                consume += monthConsume;
                yearSurplus += monthCardinal;

                extraIncome += count * 0.7 * 0.003;

//                consume += 5000;
            }

            System.out.println(yearSurplus);
            System.out.println(i + "年结余：" + (yearSurplus - monthConsume * 12));

            System.out.println();
            cardinal += yearIncrement;


        }

        System.out.println("消耗：" + consume);
        System.out.println("公余：" + tax);
        System.out.println("消结余：" + (count - consume));
        System.out.println("终余：" + (count - consume - tax));
        System.out.println("万分之三收益："+extraIncome);
    }
}
